#include<stdio.h>
int Qs(int a[],int left,int right,int k){
    int i=left,j=right,temp;
    if(left<right){
        temp = a[left];
        while(i!=j){
            while(j>i&&a[j]>=temp) j--;
            a[i] = a[j];
            while(j>i&&a[i]<=temp) i++;
            a[j] = a[i];
        }
        a[i] = temp;
        if(k-1==i) return a[i];
        else if(k-1<i) return Qs(a,left,i-1,k);
        else return Qs(a,i+1,right,k);
    }else if(left==right&&left==k-1) return a[k-1];
}


int main(){
    int n=0,k=0;
    scanf("%d%d",&n,&k);
    int a[n];
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    printf("%d",Qs(a,0,n-1,k));
}